<include file="Inc/header" />
<div class="margin10px">
	<table class="mytable">
		<tr>
			<th width="40">ID</th>
			<th>分组名称</th>
			<th width="60">状态</th>
			<th width="80">操作</th>
		</tr>
		<?php if($list){foreach($list as $v){?>
		<tr>
			<td class="tdf"><?php echo $v['group_id'];?></td>
			<td <?php if($v['group_pid']=='0'){echo 'class="bgc_eaf7fe"';}?>><?php echo str_repeat('&nbsp;', 9*(intval($v['group_depth']))).$v['group_name'];?></td>
			<td><span class="cursorpointer" onclick="groupStatus(<?php echo $v['group_id'];?>, <?php echo (1-$v['st']);?>)"><?php if($v['st']==1){echo '<font color="green">正常</font>';}else{echo '<font color="red">禁用</font>';}?></span></td>
			<td>
            	<a href="<?php echo U('admin/acl/group_del', array('group_id'=>$v['group_id']));?>" onclick="javascript:return confirm('提示：您确定要删除吗？')">删除</a> /
                <a href="<?php echo U('admin/acl/group_edit', array('group_id'=>$v['group_id']));?>">修改</a>
            </td>
		</tr>
		<?php }}else{?>
		<tr>
			<td colspan="4">没有数据</td>
		</tr>
		<?php }?>
	</table>
</div>
<script type="text/javascript">
function groupStatus(group_id, st){
	$.ajax({
		url:'<?php echo U('admin/acl/ajax_group_st');?>',
		data:({'group_id':group_id, 'st':st}),
		type:'post',
		success:function(msg){
			if(msg == 'ok'){
				alert('操作成功');
				location.reload();
			}else{
				alert(msg);
			}
		},
		error:function(){
			alert('网络繁忙，请稍后重试');
		}
	})
}
</script>
<include file="Inc/footer" />